<?php

/**

 * 验证码接口文件

 * @author maniac

 */

namespace app\api\controller\v1;
use app\facade\Verify AS VerifyFacade;
use app\facade\Members AS MembersFacade;
use app\common\model\Members;

class Verify extends Base
{
    /**
     * 获取验证码
     */
    public function verify()

    {

        $mobile   = input('post.mobile/s');

//        $type   = input('post.type/s');

        if (empty($mobile)) {

            return j(1, '请输入注册手机号');

        }
//        $where = [
//
//            'mobile' => $mobile,
//
//        ];
//        $member_mod = new Members();
//        $user = $member_mod->get_info($where,'id');
//
//        if (!empty($user)) {
//
//            return j(1, '您的手机已注册，请直接登录。');
//
//        }

        try {

            $verify = VerifyFacade::change($mobile);

            return j(0, '获取验证码成功', $verify);

        } catch (\Exception $e) {

            return j(1, $e->getMessage());

        }

    }

}

